﻿<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="ucCaNhan.ascx.cs" Inherits="STT.Admin.UserControls.ucCaNhan" %>

<div id="content-header">
    <div id="breadcrumb">
        <a href="../Admin/Default.aspx?idpage=1" class="tip-bottom" data-original-title="Về bảng điều khiển">
            <i class="icon-home"></i>Trang chính
        </a>
        <a href="../Admin/Default.aspx?" class="current">Cá nhân</a>        
    </div>
</div>
<div class="widget-box collapsible">
    <div class="widget-title">
        <a href="#collapseOne" data-toggle="collapse" class="">
            <span class="icon"><i class="icon-th"></i></span>
            <h5>Thông tin cá nhân</h5>
        </a>
    </div>
        <asp:DataList ID="DtlCaNhan" runat="server" DataKeyField="MaGV" Width="100%" CellPadding="0" CellSpacing="0" BackColor="White" BorderColor="White" BorderStyle="Ridge" BorderWidth="1px" OnCancelCommand="DtlCaNhan_CancelCommand" OnDeleteCommand="DtlCaNhan_DeleteCommand" OnEditCommand="DtlCaNhan_EditCommand" OnUpdateCommand="DtlCaNhan_UpdateCommand" OnItemDataBound="DtlCaNhan_ItemDataBound" >
        <ItemTemplate>
         <div class="widget-content nopadding">
            <div class="dataTables_wrapper" role="grid">
                <%-- Cac dieu kien tim kiem --%>
                <div class="container-fluid">
                    <div class="row-fluid">
                        <div class="span6">
                            <div class="control-group">
                                <label class="control-label">Mã Tài Khoản: </label>
                                <div class="controls">
                                    <asp:Label ID="Label1" runat="server" Text='<%# Eval("MaGV") %>' class="span20"></asp:Label>
                                </div>
                            </div>
                            <div class="control-group">
                                <label class="control-label">Tên Cá Nhân: </label>
                                <div class="controls">
                                    <asp:Label ID="Label2" runat="server" Text='<%# Eval("TenGV") %>' class="span20"></asp:Label>
                                </div>
                            </div>
                            <div class="control-group">
                                <label class="control-label">Số điện thoại :</label>
                                <div class="controls">
                                    <asp:Label ID="Label3" runat="server" Text='<%# Eval("Sdt") %>' class="span20"></asp:Label>     
                                </div>
                            </div>
                             <div class="control-group">
                                <label class="control-label">Địa chỉ : </label>
                                <div class="controls">
                                    <asp:Label ID="Label4" runat="server" Text='<%# Eval("DiaChi") %>' class="span20"></asp:Label>
                                </div>
                            </div>
                         </div>
                         <div class="span6"> 
                          <div class="control-group">
                            <label class="control-label">Ghi chú :</label>
                            <div class="controls">
                                <asp:Label ID="Label5" runat="server" Text='<%# Eval("Ghichu") %>' class="span20"></asp:Label>         
                            </div>
                        </div>
                        <div class="control-group">
                            <label class="control-label">Ảnh đại diện :</label>
                            <div class="controls">
                                <asp:Image ID="imganh" runat="server" ImageUrl='<%# "~/Uploads/Avatar/" + Eval("Anh") %>' Width="90px" Height="100px" />  
                            </div>
                        </div>   
                        </div>
                    </div>
                </div>
                <div class="fg-toolbar ui-toolbar ui-widget-header ui-corner-bl">
                    <asp:Button ID="btLuu" runat="server" CommandName="Edit"  Text="Chỉnh sửa" CssClass="btn btn-info"/><br />
                    <asp:LinkButton ID="LinkButton1" runat="server" Font-Italic="true" Font-Size="10px" OnClick="LinkButton1_Click">&nbsp (Đổi mật khẩu)</asp:LinkButton>
                </div>
            </div>
        </div>
        </ItemTemplate>
        <EditItemTemplate>
            <div class="widget-content nopadding">
            <div class="dataTables_wrapper" role="grid">
                <%-- Cac dieu kien tim kiem --%>
                <div class="container-fluid">
                    <div class="row-fluid">
                        <div class="span6">
                            <div class="control-group">
                                <label class="control-label">Mã Tài Khoản: </label>
                                <div class="controls">
                                    <asp:TextBox ID="txtMacanhan" runat="server" ReadOnly="true" class="span11" placeholder="Mã tài khoản" Text='<%# Bind("MaGV") %>'></asp:TextBox>
                                </div>
                            </div>
                            <div class="control-group">
                                <label class="control-label">Tên Cá Nhân: </label>
                                <div class="controls">
                                    <asp:TextBox ID="txtTencanhan" runat="server" class="span11" placeholder="Tên cá nhân" Text='<%# Bind("TenGV") %>'></asp:TextBox>
                                    <asp:RequiredFieldValidator ID="RequiredFieldValidator3" runat="server" ErrorMessage="*" ControlToValidate="txtTencanhan" ToolTip="Bạn chưa nhập tên cá nhân" ForeColor="Red" Font-Bold="true" ValidationGroup="editprofile"></asp:RequiredFieldValidator>
                               </div>
                            </div>
                            <div class="control-group">
                                <label class="control-label">Số điện thoại :</label>
                                <div class="controls">
                                   <asp:TextBox ID="txtsdt" runat="server" class="span11" placeholder="Số điện thoại" Text='<%# Bind("Sdt2") %>'></asp:TextBox>
                                  <asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" ErrorMessage="*" ControlToValidate="txtsdt" ToolTip="Bạn chưa nhập số điện thoại" ForeColor="Red" Font-Bold="true" ValidationGroup="editprofile"></asp:RequiredFieldValidator>
                                  <asp:RegularExpressionValidator ID="RegularExpressionValidator1" runat="server" ControlToValidate="txtsdt" ErrorMessage="*" ValidationExpression="09\d{8}|01[2689]\d{8}" ValidationGroup="editprofile" ForeColor="Red" ToolTip="Bạn Nhập sai định dạng số điện thoại"></asp:RegularExpressionValidator>           
                                 </div>
                            </div>
                            <div class="control-group">
                                <label class="control-label">Địa chỉ : </label>
                                <div class="controls">
                                    <asp:TextBox ID="txtdiachi" runat="server" class="span11" placeholder="Địa chỉ" Text='<%# Bind("DiaChi") %>'></asp:TextBox>
                                    <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ErrorMessage="*" ControlToValidate="txtdiachi" ToolTip="Bạn chưa nhập địa chỉ" ForeColor="Red" Font-Bold="true" ValidationGroup="editprofile"></asp:RequiredFieldValidator>
                                </div>
                            </div>
                        </div>
                        <div class="span6">
                        <div class="control-group">
                                <label class="control-label">Ghi chú :</label>
                                <div class="controls">
                                      <asp:TextBox ID="txtghichu" runat="server" class="span11" TextMode="MultiLine" placeholder="Ghi chú" Text='<%# Bind("Ghichu") %>'></asp:TextBox>
                                      <asp:RequiredFieldValidator ID="RequiredFieldValidator6" runat="server" ErrorMessage="*" ControlToValidate="txtghichu" ToolTip="Bạn chưa nhập ghi chú" ForeColor="Red" Font-Bold="true" ValidationGroup="editprofile"></asp:RequiredFieldValidator>
                                </div>
                            </div>
                            <div class="control-group">
                                <label class="control-label">Ảnh đại diện :</label>
                                <div class="controls">
                                    <asp:Image ID="imganh" runat="server" ImageUrl='<%# "~/Uploads/Avatar/" + Eval("Anh") %>' Width="100px" Height="115px" />
                                    <br /><asp:FileUpload ID="Fulanh" runat="server" />
                                    <asp:TextBox ID="txtanh" runat="server" Text='<%# Eval("Anh") %>' Visible="false"></asp:TextBox>
                                </div>
                            </div>
                           
                    </div>
                </div>
                <div class="fg-toolbar ui-toolbar ui-widget-header ui-corner-bl">
                    <asp:Button ID="btsave" runat="server" Text="Thay đổi" CssClass="btn btn-info" CommandName="Update" ValidationGroup="editprofile"/>
                    <asp:Button ID="bthuy" runat="server" Text="Hủy" CssClass="btn btn-info" CommandName="Cancel" CausesValidation="false"/>
                </div>
            </div>
            </div>
      </EditItemTemplate>
        </asp:DataList>
 </div>
<script>

    $('#ctl01_DtlCaNhan_imganh_0').click(function () {

        $('#ctl01_DtlCaNhan_Fulanh_0').click();
    });
    $('#ctl01_DtlCaNhan_Fulanh_0').change(function () {
        readURL(this, '#ctl01_DtlCaNhan_imganh_0');
    });
    function readURL(input, imgAnhDaiDien) {

        if (input.files && input.files[0]) {
            var reader = new FileReader();
            reader.onload = function (e) {
                $(imgAnhDaiDien).attr('src', e.target.result);
            }
            reader.readAsDataURL(input.files[0]);
        }
    }
</script>